Gatsby Default StarterGatsby logo

#systems #LinuxClient

  • [[Hypervisor]]
  • VMWare
  • Terminal
  • Bash

Things to learn

  1. Navigation
  2. Command
  3. Users and privileges
  4. Pipe
  5. Grep

When installing; Network connection To choose: bridged

first thing; *upgrade and update

sudo apt install tree to install tree viewer of directories in a better way

studied from : https://ubuntu.com/tutorials/command-line-for-beginners#1-overview

Shortcuts linux

ctrl alt T : terminal

alt shift f ; for fullscreen (custom)

sudo ; change user to administrator, have admin rights

apt ; package manager

sudo apt upgrade; we do it when we start with a new system to upgrade everything

and then we do ;

sudo apt upgrade ; to install them

upgrade to fetch, update to install

admin2@MintCinnamon: touch test
admin2@MintCinnamon: ls test
admin2@MintCinnamon: cd test

Nano for text editor in Linux

Container is for terminal, for example like Python or Shell

/ directory is the root directory cd / to go to the root pwd ; print working directory

cd .. ; to go to the upper file cd ../.. ; to go multiple times to upper file pwd : show directory cd : change directory

cd /etc ; to go to a directory directly

whoami ; to find admin username

cd /home/USERNAME/Desktop ; to go to Desktop cd ~/Desktop ; to go to Desktop as well. ~ is the home folder / is the root folder

cd . current dir cd .. upper dir cd ~ home dir cd - previous dir

ls -a to list hidden files as well ls -l for detailed list with data of permissions, number of links, owner user, owner group, filesize, last mod time, file/dir name ls -al to do both at the same time. Order doesn't matter. ls -r reverse the order of the list while sorting ls -t sort by mod time ls -R recursively (art arda diz) sort files/dirs

less to view the text content nano to open text editor

history or ctrl+R to view history off all the commands i've used clear to clear the board of the terminal

mv to move (multiple) files/dirs, change name of files/dirs, mv -b will rename the file create an old file starting with the ~ symbol.

mkdir (make directory) ; create a new directory mkdir dir1 dir2; to create 2 folders mkdir -p dir3/dir4 ; to create folders inside folders -- with sub-directories

ls > output.txt ; to create a text file with the results of the current ls cat output.txt ; to view what is inside the text file

ls : list documents touch : create text document curl wttr.in/Strasbourg ; to fetch weather in terminal

cat for showing the contents of the txt ? for taking all the same characters in a directory

    • for zero or more characters or to say any files

![[Capture d’écran 2024-02-22 120040.png]]

less combined.txt ; to see the content of the combined.txt as a whole page q ; to quit

m for moving m combined.txt dir1 ; to move it inside the directory ls dir1 ; to JUST view what is inside the dir1, not to go there

let's move it back to the previous directory in the upper folder.

mv dir1/* . means move any content in dir1 to . (. means the current directory)

mv combined.txt test_* dir3 dir2 will move first 3 documents to dir2 directory

let's say that we did a mistake and we want to move combined.txt to dir6

mv dir2/combined.txt dir4/dir5/dir6 to move it to dir6

you can move files wherever you are

cp ; to copy files

to change the name of a document;

mv backup_combined.txt combined_backup.txt

mv ; to move and to change name

rmdir to remove directories

when removing objects or directories, you can write them side by side with a space.

rm -r to delete everything inside the directory even if there are other directories in it. tough it's dangerous

rm t* to delete everything that start with t

rm -i to add a security layer before deleting that asks Y/n ?

rm -f to force delete

find /home -name puppy.jpg to find files with name puppy.jpg in home directory find -type d -name Folder to find dirs with the name of Folder in the current dir

help for details of the commands, what could be done etc

whatis for what the command does

alias foobar='ls -al' to create aliases for any kind of multiple commands. they should be written inside ~/.bashrc to make them permanent even after reboot. unalias to break the alias.

wc -l for word count and line count

![[Capture d’écran 2024-02-22 135946.png]]

ls ~ | wc -l

-l is to see the lines inside a txt folder but to see item count in a directory as well

man is for seeing the manual of any command q for quitting

ctrl + c for quitting a command on linux

ls /etc|less to view all the items in etc directory q to quit

cat combined.txt | uniq |wc -l to see the word count in the txt file

cat combined.txt | uniq | less to see in a more clear view

sort will sort the lines in the alphabetical order

sort combined.txt | uniq | wc -l to list only the unique lines

cat doesn't list only the unique lines but sort lists.

reset to clear the terminal but it keeps the cache and password

. starting files are hidden

curl get info from a website

apt for installing new apps

pkill or kill (app name) to close an app

ctrl + d to quit the terminal in Linux or logout command

![[Pasted image 20240222155634.png]]

d for directory

    • for file

rwx : read write execute rights

first rwx is the creator of the file/directory second rwx is the groups third rwx is the others

chmod o+rw test or chmod o-rwx test

o for others, test for the test file we created

700 means I have all the rights, others have no rights 777 means everybody has all the rights

760 to give r+w rights to group users ; why 6 ? because rwx is binary so 421 = 2^2 , 2^1 , 2^0

./ to execute the file, any type of file. for example: ./test

u for me g for groups o for others

ugo+rwx or u-rw or could be any kind

sudo su to see who is the user